<?php

namespace app\admin\model;

use think\Db;
use think\Model;

class KuaiDiOptionsModel extends Model {

    public function getOptionsList()
    {
        
        $list = Db::table('kuaidi_options')->select();
        $res['success'] = true;
        $res['desc'] = '';
        $res['errorcode'] = '';
        $res['data']['list'] = $list;
        return $res;

    }

    public function getStatisticsInfo() {
        $orderCnt = Db::table('kuaidi_help_order')->count();
        //当天的订单量
        $todayOrderCnt = Db::table('kuaidi_help_order')->where('create_time', '>=', date('Y-m-d', time()))->where('create_time', '<=', date('Y-m-d 23:59:59', time()))->count();
        $userCnt = Db::table('kuaidi_user')->where('open_id', '<>', '')->count();

        $res['success'] = true;
        $res['desc'] = '';
        $res['errorcode'] = '';
        $res['data'] = [
            'userCnt' => $userCnt,
            'todayOrderCnt' => $todayOrderCnt,
            'orderCnt' => $orderCnt,
        ];
        return $res;
    }

}